package br.unisinos.aidk.searcher;

import java.util.LinkedList;

import br.unisinos.aidk.graph.Node;
import br.unisinos.aidk.graph.Queue;

public class DepthSearch<V> implements SearchStrategy<V>{

	private int maxDepth;
	
	public DepthSearch(int md){
		maxDepth = md;
	}
	
	@Override
	public boolean apply(Queue<Node<V>> queue, LinkedList<Node<V>> nodes) {
		if(nodes.size()==0) return false;
		if(nodes.element().getDepth()<=maxDepth){
			queue.insertAll(nodes);
			return true;
		}
		return false;
	}
}
